package main

import (
	a "goShopping/superShopping/superShopping/Controller"
	"goShopping/superShopping/superShopping/Dao"
	"goShopping/superShopping/superShopping/Models"
	"goShopping/superShopping/superShopping/Pay"
	"goShopping/superShopping/superShopping/Redis"
	"goShopping/superShopping/superShopping/Rounter"
)

func main(){
	a.AliPayClient = Pay.Inits(Pay.Config{
		KAppID:               a.KAppID,
		KPrivateKey:          a.KPrivateKey,
		IsProduction:         a.IsProduction,
		AppPublicCertPath:    a.AppPublicCertPath,
		AliPayRootCertPath:   a.AliPayRootCertPath,
		AliPayPublicCertPath: a.AliPayPublicCertPath,
		NotifyURL:            a.NotifyURL,
		ReturnURL:            a.ReturnURL,
		Timeout_express:      a.Timeout_express,
	})

	err:= Dao.InitMysql()
	if err!=nil{
		panic(err)
	}
	err=Redis.SetupRedisDb()
	if err!=nil{
		panic(err)
	}
	defer Dao.Close()
	defer Redis.RedisDb.Close()
	Dao.Db.AutoMigrate(&Models.User{})
	Dao.Db.AutoMigrate(&Pay.Order{})

	Rounter.InitGin()
}
